#!/bin/bash

# Step 1: Clean and install with Maven (using a specific profile)
echo "Running Maven clean and install with profile 'local'..."
mvn clean install -P local

# Step 2: Build the Docker image using the Dockerfile in the current directory
echo "Building Docker image..."
docker build -t user-center .

# Step 3: Run the Docker container
echo "Running the Docker container..."
docker run -d \
  --name user-center \
  --network cloud-server \
  --ip 192.168.107.7 \
  -p 8890:8890 \
  -v /Volumes/SD/MuLu/logger/user-center:/opt/ \
  user-center

# Step 4: Connect the container to the bridge network
echo "Connecting the container to the bridge network..."
docker network connect bridge user-center

echo "Script execution completed successfully!"
